<?php
namespace app\index\validate;

use think\Validate;

class User extends Validate
{
    protected $rule = [
        'username'  =>  'require|min:6',
        'phone' =>  ['regex'=>'/^1[3|4|5|7|8][0-9]{9}$/'],
        'password' => 'require|min:6',
        'email' => 'email',
        'age'   => 'number|between:1,120',
        'summary' => 'max:70'
    ];
    protected $message = [
        'username.require'  =>  '用户名错误',
        'username.min'  =>  '用户名过短',
        'phone' =>  '手机号错误',
        'password' => '密码填写错误',
        'email' =>'邮箱填写错误',
        'age.number'   => '年龄必须是数字',
        'age.between'  => '年龄只能在1-120之间',
        'summary.max'  => '字数超出限制',
    ];
    protected $scene = [
        'edit'  =>  ['email','age','summary'],
    ];
}